1
2 import java.sql.Connection;
3 import java.sql.DriverManager;
4 import java.sql.Statement;

5
6 /*
7  * To change
this license header, choose License Headers in Project Properties.
8  * To change
this template file, choose Tools | Templates
9  * and open the template
in the editor.
10  */
11
12 /**
13  *
14  * @author MY LAPI
15  */

16 public
class IBReg extends javax.swing.JFrame {
17
18     
/**
19      * Creates
new form IBReg
20      */

21     
public IBReg() {
22         initComponents();
23     }
24
25     
/**
26      * This method
is called from within the constructor to initialize the form.
27      * WARNING: Do NOT modify
this code. The content of this method is always
28      * regenerated
by the Form Editor.
29      */

30     @SuppressWarnings(
"unchecked")
31     
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
32     
private void initComponents() {
33
34         jLabel1 =
new javax.swing.JLabel();
35         jLabel2 =
new javax.swing.JLabel();
36         jTextField1 =
new javax.swing.JTextField();
37         jLabel3 =
new javax.swing.JLabel();
38         jButton1 =
new javax.swing.JButton();
39         jButton2 =
new javax.swing.JButton();
40         jButton3 =
new javax.swing.JButton();
41         jLabel4 =
new javax.swing.JLabel();
42         jTextField3 =
new javax.swing.JTextField();
43         jLabel5 =
new javax.swing.JLabel();
44         jPasswordField1 =
new javax.swing.JPasswordField();
45         jPasswordField2 =
new javax.swing.JPasswordField();
46         jLabel6 =
new javax.swing.JLabel();
47
48         setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
49
50         jLabel1.setFont(
new java.awt.Font("Arial Unicode MS", 0, 18)); // NOI18N
51         jLabel1.setText(
"STAR BANK Net Banking");
52
53         jLabel2.setFont(
new java.awt.Font("Arial Unicode MS", 0, 14)); // NOI18N
54         jLabel2.setText(
"Email");
55
56         jLabel3.setFont(
new java.awt.Font("Arial Unicode MS", 0, 14)); // NOI18N
57         jLabel3.setText(
"Password");
58
59         jButton1.setFont(
new java.awt.Font("Arial Unicode MS", 0, 14)); // NOI18N
60         jButton1.setText(
"Reset");
61         jButton1.addActionListener(
new java.awt.event.ActionListener() {
62             
public void actionPerformed(java.awt.event.ActionEvent evt) {
63                 jButton1ActionPerformed(evt);
64             }
65         });
66
67         jButton2.setFont(
new java.awt.Font("Arial Unicode MS", 0, 14)); // NOI18N
68         jButton2.setText(
"SignUp");
69         jButton2.addActionListener(
new java.awt.event.ActionListener() {
70             
public void actionPerformed(java.awt.event.ActionEvent evt) {
71                 jButton2ActionPerformed(evt);
72             }
73         });
74
75         jButton3.setText(
"Already have an Account");
76         jButton3.addActionListener(
new java.awt.event.ActionListener() {
77             
public void actionPerformed(java.awt.event.ActionEvent evt) {
78                 jButton3ActionPerformed(evt);
79             }
80         });
81
82         jLabel4.setFont(
new java.awt.Font("Arial Unicode MS", 0, 14)); // NOI18N
83         jLabel4.setText(
"Mobile");
84
85         jLabel5.setFont(
new java.awt.Font("Arial Unicode MS", 0, 14)); // NOI18N
86         jLabel5.setText(
"OTP");
87
88         jLabel6.setForeground(
new java.awt.Color(255, 51, 51));
89
90         javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(getContentPane());
91         getContentPane().setLayout(layout);
92         layout.setHorizontalGroup(
93             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
94             .addGroup(layout.createSequentialGroup()
95                 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
96                 .addComponent(jButton1)
97                 .addGap(
57, 57, 57)
98                 .addComponent(jButton2)
99                 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
100             .addGroup(layout.createSequentialGroup()
101                 .addGap(
89, 89, 89)
102                 .addComponent(jLabel1)
103                 .addContainerGap(
96, Short.MAX_VALUE))
104             .addGroup(layout.createSequentialGroup()
105                 .addGap(
121, 121, 121)
106                 .addComponent(jButton3)
107                 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
108             .addGroup(layout.createSequentialGroup()
109                 .addGap(
52, 52, 52)
110                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
111                     .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE,
79, javax.swing.GroupLayout.PREFERRED_SIZE)
112                     .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE,
79, javax.swing.GroupLayout.PREFERRED_SIZE)
113                     .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE,
79, javax.swing.GroupLayout.PREFERRED_SIZE)
114                     .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE,
79, javax.swing.GroupLayout.PREFERRED_SIZE))
115                 .addGap(
44, 44, 44)
116                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
117                     .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE,
173, Short.MAX_VALUE)
118                     .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
119                         .addComponent(jTextField3, javax.swing.GroupLayout.DEFAULT_SIZE,
173, Short.MAX_VALUE)
120                         .addComponent(jTextField1)
121                         .addComponent(jPasswordField1)
122                         .addComponent(jPasswordField2)))
123                 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
124         );
125         layout.setVerticalGroup(
126             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
127             .addGroup(layout.createSequentialGroup()
128                 .addContainerGap()
129                 .addComponent(jLabel1)
130                 .addGap(
24, 24, 24)
131                 .addComponent(jLabel6)
132                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
133                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
134                     .addComponent(jLabel2)
135                     .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
136                 .addGap(
18, 18, 18)
137                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
138                     .addComponent(jLabel4)
139                     .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
140                 .addGap(
18, 18, 18)
141                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
142                     .addComponent(jLabel3)
143                     .addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
144                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
32, Short.MAX_VALUE)
145                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
146                     .addComponent(jLabel5)
147                     .addComponent(jPasswordField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
148                 .addGap(
18, 18, 18)
149                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
150                     .addComponent(jButton2)
151                     .addComponent(jButton1))
152                 .addGap(
18, 18, 18)
153                 .addComponent(jButton3)
154                 .addContainerGap())
155         );
156
157         pack();
158     }
// </editor-fold>//GEN-END:initComponents
159
160     
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
161                 IBReg pb1=
new IBReg();
162                 IBLog pb2=
new IBLog();
163                 pb1.setVisible(
false);
164                 pb2.setVisible(
true);
165                 dispose();
166     }
//GEN-LAST:event_jButton3ActionPerformed
167
168     
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
169        
if(jPasswordField2.getText()!=""){
170            
try{
171             Class.forName(
"com.mysql.jdbc.Driver").newInstance();
172             Connection cn=DriverManager.getConnection(
"jdbc:mysql://localhost:3306/bank","root","");
173     
174             Statement smt=cn.createStatement();
175             String p=
"update user set password='"+jPasswordField1.getText()+"' where email='"+jTextField3.getText()+"' and mobile='"+jTextField1.getText()+"' ";
176            smt.executeUpdate(p);
177         IBReg pb1=
new IBReg();
178                 IBLog pb2=
new IBLog();
179                 pb1.setVisible(
false);
180                 pb2.setVisible(
true);
181                 dispose();
182     
183         }
catch(Exception e){ jLabel6.setText("** Wrong Email OR Mobile **");}
184        
185        }
else{
186            jLabel6.setText(
" Please Input OTP");
187        }
188     }
//GEN-LAST:event_jButton2ActionPerformed
189
190     
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
191        jPasswordField1.setText(
"");
192        jTextField3.setText(
"");
193        jTextField1.setText(
"");
194        jPasswordField2.setText(
"");
195        
196     }
//GEN-LAST:event_jButton1ActionPerformed
197
198     
/**
199      * @param args the command line arguments
200      */

201     
public static void main(String args[]) {
202         
/* Set the Nimbus look and feel */
203         
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
204         
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
205          * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
206          */

207         
try {
208             
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
209                 
if ("Nimbus".equals(info.getName())) {
210                     javax.swing.UIManager.setLookAndFeel(info.getClassName());
211                     
break;
212                 }
213             }
214         }
catch (ClassNotFoundException ex) {
215             java.util.logging.Logger.getLogger(IBReg.
class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
216         }
catch (InstantiationException ex) {
217             java.util.logging.Logger.getLogger(IBReg.
class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
218         }
catch (IllegalAccessException ex) {
219             java.util.logging.Logger.getLogger(IBReg.
class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
220         }
catch (javax.swing.UnsupportedLookAndFeelException ex) {
221             java.util.logging.Logger.getLogger(IBReg.
class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
222         }
223         
//</editor-fold>
224
225         
/* Create and display the form */
226         java.awt.EventQueue.invokeLater(
new Runnable() {
227             
public void run() {
228                 
new IBReg().setVisible(true);
229             }
230         });
231     }
232
233     
// Variables declaration - do not modify//GEN-BEGIN:variables
234     
private javax.swing.JButton jButton1;
235     
private javax.swing.JButton jButton2;
236     
private javax.swing.JButton jButton3;
237     
private javax.swing.JLabel jLabel1;
238     
private javax.swing.JLabel jLabel2;
239     
private javax.swing.JLabel jLabel3;
240     
private javax.swing.JLabel jLabel4;
241     
private javax.swing.JLabel jLabel5;
242     
private javax.swing.JLabel jLabel6;
243     
private javax.swing.JPasswordField jPasswordField1;
244     
private javax.swing.JPasswordField jPasswordField2;
245     
private javax.swing.JTextField jTextField1;
246     
private javax.swing.JTextField jTextField3;
247     
// End of variables declaration//GEN-END:variables
248 }


Gõ tìm kiếm nhanh...